package day5;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @author oldliu
 * @since 1.0
 */
public class InputStreamTest1 {
    public static void main(String[] args) {
        FileInputStream fin = null;
        try {
            fin = new FileInputStream("E:\\temp\\java75\\namelist.txt");
//            int ch=fin.read();
//            System.out.println(ch);
//            ch=fin.read();
//            System.out.println(ch);
//            ch=fin.read();
//            System.out.println(ch);
            //读完
            int ch = 0;
            System.out.println("多少可读？" + fin.available());
            while ((ch = fin.read()) != -1) {
                System.out.println(ch + ":" + (char) ch);
                System.out.println("多少可读？" + fin.available());
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (fin != null)
                    fin.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
